/*
-----------------------------------------------------------------------------
This source file is part of Labor3D
(Labor 3D Graphics Engine)

Copyright (c) 2009-2020 Rock Mao
* creator : Rock Mao
* created : 2010-6-1   11:12
* filename: LFileOperateCommon.h

-----------------------------------------------------------------------------
*/

#ifndef __LFILEOPERATECOMMON_H__
#define __LFILEOPERATECOMMON_H__


#include <string>

#include <stdio.h>
#include <iostream>
#include <ios>
#include <fstream>
#include <direct.h>
#include <stdlib.h>

#define PATH_SPLITTER_STRING L"/"

static bool file_exist(const wchar_t* file_name)
{
	FILE* file = _wfopen(file_name , L"rb");
	if(file == NULL)
	{
		return false;
	}
	fclose(file);
	return true;
}

int getFileLen(const wchar_t * file_name);
int getFileBuffer(const wchar_t * file_name, char** ucs16Buff);
std::wstring getFileName(const wchar_t* fullName);
std::wstring getPathName(const wchar_t* fullName);
void create_all_dir(const wchar_t* bas_dir,const wchar_t* file);

bool _write_data_to_file(const char* pData, const wchar_t* file_name, int nLength );

#endif